package com.ruoyi.web.controller.dr;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dr.domain.DrHomeFansLike;
import com.ruoyi.dr.service.IDrHomeFansLikeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 粉丝购买偏好  关联daren_home_fans_data Controller
 * 
 * @author ruoyi
 * @date 2025-07-12
 */
@RestController
@RequestMapping("/dr/like")
public class DrHomeFansLikeController extends BaseController
{
    @Autowired
    private IDrHomeFansLikeService drHomeFansLikeService;

    /**
     * 查询粉丝购买偏好  关联daren_home_fans_data 列表
     */
    @PreAuthorize("@ss.hasPermi('dr:like:list')")
    @GetMapping("/list")
    public TableDataInfo list(DrHomeFansLike drHomeFansLike)
    {
        startPage();
        List<DrHomeFansLike> list = drHomeFansLikeService.selectDrHomeFansLikeList(drHomeFansLike);
        return getDataTable(list);
    }

    /**
     * 导出粉丝购买偏好  关联daren_home_fans_data 列表
     */
    @PreAuthorize("@ss.hasPermi('dr:like:export')")
    @Log(title = "粉丝购买偏好  关联daren_home_fans_data ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DrHomeFansLike drHomeFansLike)
    {
        List<DrHomeFansLike> list = drHomeFansLikeService.selectDrHomeFansLikeList(drHomeFansLike);
        ExcelUtil<DrHomeFansLike> util = new ExcelUtil<DrHomeFansLike>(DrHomeFansLike.class);
        util.exportExcel(response, list, "粉丝购买偏好  关联daren_home_fans_data 数据");
    }

    /**
     * 获取粉丝购买偏好  关联daren_home_fans_data 详细信息
     */
    @PreAuthorize("@ss.hasPermi('dr:like:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(drHomeFansLikeService.selectDrHomeFansLikeById(id));
    }

    /**
     * 新增粉丝购买偏好  关联daren_home_fans_data 
     */
    @PreAuthorize("@ss.hasPermi('dr:like:add')")
    @Log(title = "粉丝购买偏好  关联daren_home_fans_data ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DrHomeFansLike drHomeFansLike)
    {
        return toAjax(drHomeFansLikeService.insertDrHomeFansLike(drHomeFansLike));
    }

    /**
     * 修改粉丝购买偏好  关联daren_home_fans_data 
     */
    @PreAuthorize("@ss.hasPermi('dr:like:edit')")
    @Log(title = "粉丝购买偏好  关联daren_home_fans_data ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DrHomeFansLike drHomeFansLike)
    {
        return toAjax(drHomeFansLikeService.updateDrHomeFansLike(drHomeFansLike));
    }

    /**
     * 删除粉丝购买偏好  关联daren_home_fans_data 
     */
    @PreAuthorize("@ss.hasPermi('dr:like:remove')")
    @Log(title = "粉丝购买偏好  关联daren_home_fans_data ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(drHomeFansLikeService.deleteDrHomeFansLikeByIds(ids));
    }
}
